/**
 * 运费模板相关接口
*/

import request from '@/utils/httpRequest'

// 列表获取
export const getAllList = () => {
    return request({
        url: '/v1/freight/template/all/list',
        method: 'GET'
    })
}

// 删除模板
export const delTemplateById = (data) => {
    return request({
        url: '/v1/freight/template/delete',
        method: 'POST',
        data
    })
}

// 通过ID获取模板
export const getTemplateById = (id) => {
    console.log(id)
    return request({
        url: '/v1/freight/template/get',
        method: 'GET',
        params: {
            id
        }
    })
}

// 有分页的列表
export const getTemplateList = (params = {}) => {
    return request({
        url: '/v1/freight/template/list',
        method: 'GET',
        params
    })
}

// 新增、更新模板

export const addAndUpdate = (data) => {
    return request({
        url: '/v1/freight/template/save',
        method: 'POST',
        data
    })
}

// 一级类目获取
export const getCategory = () => {
    return request({
        url: '/bsnl-product/category/tree',
        method: 'get'
    })
}

// 配置运费模板
export const saveTplConf = (data) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/doSave',
        method: 'POST',
        data
    })
}

// 配置运费模板数据获取
export const getTplConf = (params) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/detail',
        method: 'GET',
        params
    })
}

// 配置运费模板列表
export const getTplConfList = (params) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/page',
        method: 'GET',
        params
    })
}

// 根据id获取箱起
export const getBoxList = (data) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/box/series/list',
        method: 'post',
        data
    })
}
// 根据id获取商品
export const getGoodList = (data) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/goods/list',
        method: 'post',
        data
    })
}
// 根据id获取套餐
export const getpackageList = (data) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/package/list',
        method: 'post',
        data
    })
}
// 根据id获取合伙人
export const getPartnerList = (data) => {
    return request({
        url: '/bsnl-product/freightTemplateConfig/package/partner/list',
        method: 'post',
        data
    })
}